<template>
	<view>
		<view class="contentItem" v-for="(item,index) in ArticleList" :key="index" @click="godetails(item)">
			<view class="header">
				<!-- 序号 -->
				<view class="serialnumber"></view>
				<view class="title">
					{{item.title}}
				</view>
			</view>
			<view class="publisher">
				<view class="name">
					发布人：{{item.user ? item.user.userName : ''}}
				</view>
			</view>
			<view class="time">
				发布时间：{{item.createTime}}
			</view>
			<view class="container">
				{{item.introduce}}
			</view>
			<view class="pageView">
				<view class="img">
					<image src="@/static/index-message/liulanliang.png" mode=""></image>
				</view>
				<view class="text">
					浏览量：{{item.pageView}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import ArticleApi from '@/api/socialized-servce/market-information/index.js'
	export default {
		data() {
			return {
				ArticleList: [], //商品数据
			};
		},
		methods: {
			// 点击跳转详情
			godetails(e) {
				let id = e.marketInformationId
				uni.redirectTo({
					url: `/subPage1/socialized-service/market-information/industry-information/article-detail/article-detail?id=${id}`
				})
			},
			//获取首页的商品数据
			getShopList(nowpage = 1, obj = {}) {
				let params = {
					condition: {
						serviceProviderNo: uni.getStorageSync('serviceProviderNo'),
						...obj
					},
					page: nowpage,
					size: 10
				};
				ArticleApi.queryPageByCondition(params).then((res) => {
					if (res.code === 200) {
						let nowtotal = res.data.totalElements;
						if (nowtotal) {
							this.$emit('com1total', nowtotal);
						}
						let list = res.data.content;
						if (list.length > 0) {
							if (nowpage === 1) {
								this.ArticleList = list;
							} else if (nowpage > 1) {
								this.ArticleList.push(...list);
							}
							this.$emit('setshowview', 1);
						} else {
							this.ArticleList = [];
							this.$emit('setshowview', -1);
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.contentItem {
		margin: 0 32rpx;
		margin-top: 16rpx;
		background-color: #FFFFFF;
		padding: 36rpx 24rpx 30rpx 24rpx;
		box-shadow: 0rpx 0rpx 12rpx 2rpx rgba(0, 0, 0, 0.05);
		border-radius: 16rpx 16rpx 16rpx 16rpx;

		.header {
			position: relative;
			// margin-left: 48rpx;

			.serialnumber {
				position: absolute;
				top: 6rpx;
				left: 0rpx;
				width: 10rpx;
				height: 28rpx;
				background-color: #91743E;
			}

			.title {
				height: 72rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				padding-left: 20rpx;
				font-weight: 500;
				color: #91743E;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				width: 100%;
			}
		}
		
		.publisher,.time {
			font-size: 28rpx;
			font-family: Arial-Regular, Arial;
			font-weight: 400;
			color: #606060;
		}
		.container {
			margin-top: 34rpx;
			margin-right: 24rpx;
			font-size: 28rpx;
			text-indent: 56rpx;
			font-family: Source Han Sans CN-Regular, Source Han Sans CN;
			font-weight: 400;
			color: #272727;
			line-height: 38rpx;
			width: 600rpx;

			.text {
				width: 600rpx;
				line-height: 38rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
		.pageView {
			margin-top: 20rpx;
			display: flex;
			align-items: center;
			image {
				width: 40rpx;
				height: 30rpx;
			}
			.text {
				margin-left: 10rpx;
				font-size: 28rpx;
				font-family: Arial-Regular, Arial;
				font-weight: 400;
				color: #606060;
			}
		}
	}
</style>